<!-- application/layouts/scripts/layout.phtml -->
<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Zend Framework Quickstart Application</title>
	<?
	echo $this->headLink()->appendStylesheet('/css/global.css')
						  ->appendStylesheet('/js/jqwidgets/styles/jqx.base.css');

	//El último es el primero que se muestra
	echo $this->headScript()->prependFile('/js/jqwidgets/jqxgrid.selection.js')
    						->prependFile('/js/jqwidgets/jqxgrid.columnsresize.js')
    						->prependFile('/js/jqwidgets/jqxgrid.pager.js')
    						->prependFile('/js/jqwidgets/jqxgrid.sort.js')
    						->prependFile('/js/jqwidgets/jqxgrid.filter.js')
    						->prependFile('/js/jqwidgets/jqxgrid.js')
							->prependFile('/js/jqwidgets/jqxvalidator.js')
							->prependFile('/js/jqwidgets/jqxwindow.js')							
							->prependFile('/js/jqwidgets/jqxbuttons.js')
					   		->prependFile('/js/jqwidgets/jqxscrollbar.js')
					   		->prependFile('/js/jqwidgets/jqxdropdownlist.js')
					   		->prependFile('/js/jqwidgets/jqxlistbox.js')
					   		->prependFile('/js/jqwidgets/jqxbuttons.js')
    						->prependFile('/js/jqwidgets/jqxscrollbar.js')
    						->prependFile('/js/jqwidgets/jqxmenu.js')
					   		->prependFile('/js/jqwidgets/jqxmenu.js')
					   		->prependFile('/js/jqwidgets/jqxtabs.js')
					   		->prependFile('/js/jqwidgets/jqxnavigationbar.js')
					   		->prependFile('/js/jqwidgets/jqxexpander.js')
					   		->prependFile('/js/jqwidgets/jqxdata.js')
					   		->prependFile('/js/jqwidgets/jqxcore.js')
					   		->prependFile('/js/global.js')
					   		->prependFile('/js/jquery-1.7.2.min.js')
					   		->prependFile('/js/gettheme.js');
	?>
	<script type="text/javascript">		
        $(document).ready(function () {
        	var theme = '',	alto = 75;            
            var menuArray = new Array('mnuCalendarioVuelos');
                        
            // Create jqxNavigationBar & jqxTab
            $("#jqxNavigationBar").jqxNavigationBar({ width: 200, sizeMode: 'maxItemHeight', theme: theme });
            $('#jqxTabs').jqxTabs({
            	theme: theme, 
                width: "99%",
                height: ($(document).height()-alto),
                showCloseButtons:true,
                position: 'top'
                });
            $('#jqxTabs').jqxTabs('hideCloseButtonAt', 0);

			//Tabs events
            $('#jqxTabs').bind('removed', function (event) {
            	var item = event.args.item;            	
            	menuArray.splice($.inArray(menuArray[item], menuArray),1);

            	$('#jqxTabs').jqxTabs('hideCloseButtonAt', 0);
            });
            $('#jqxTabs').bind('tabclick', function (event) { 
                var clickedItem = event.args.item;
                var idMenu = menuArray[clickedItem];

				if($('#jqxGrid'+idMenu).length >0){
					delay(function(){
						$('#jqxGrid'+idMenu).jqxGrid('render');
					}, 100);
				}
            });

            $('a[id^=mnu]').bind('click', function (event) {               
				event.preventDefault();
				var idMenu = nuevaTab($(this), menuArray);
            });

            $(window).resize(function() {
            	delay(function(){
            		$('#jqxTabs').jqxTabs({ height: 0 });                	
            		$('#jqxTabs').jqxTabs({ width: "99%", height: ($(document).height()-alto)});
            	}, 500);
            });
            <?php echo $this->jsView; ?>
        });
    </script>
</head>
<body class='default'>
	<div id="content-header">
		Cabecera
	</div>
	<div id="wrapper">
		<div id="content-left">
			<!-- Menú lateral -->
			<div id="jqxNavigationBar">
				<?php print_r($this->menuLat)?>
			</div>
		</div>
		<div id="content-right">
			<!-- Contenido principal -->
			<div id='jqxTabs'>
		        <ul style='margin-left: 20px;' id="ulTabsTitle">
		            <li>Calendario de vuelos</li>
		        </ul>
		        <div>		        	
		        </div>        
		    </div>
		</div>
		<?php echo $this->layout()->content ?>
	</div>
	<p id="oculto"></p>
</body>
</html>